package com.bookstore.factory;


import com.bookstore.dao.*;
import com.bookstore.dao.impl.*;

public class DaoFactory {
    private static UserDao userDao;
    private static OrderDao orderDao;
    private static NoticeDao noticeDao;
    private static OrderItemDao orderItemDao;
    private static ProductDao productDao;

    private DaoFactory() {
    }

    public static UserDao getUserDao() {
        if (userDao==null){
            return new UserDaoImpl();
        }
        return userDao;
    }

    public static OrderDao getOrderDao() {
        if (orderDao==null){
            return new OrderDaoImpl();
        }
        return orderDao;
    }

    public static NoticeDao getNoticeDao() {
        if (noticeDao==null){
            return new NoticeDaoImpl();
        }
        return noticeDao;
    }

    public static OrderItemDao getOrderItemDao() {
        if (orderItemDao==null){
            return new OrderItemDaoImpl();
        }
        return orderItemDao;
    }

    public static ProductDao getProductDao() {
        if (productDao==null){
            return new ProductDaoImpl();
        }
        return productDao;
    }
}
